<!DOCTYPE html>
<html class="no-js" lang="">

<head>#include( "/public-head.html")
</head>

<body style="background-color: #ffffff !important;">
	<div class="main-content checkbo">
		<div class="panel mb25">
			<div class="panel-heading border">系统管理</div>
			<div class="panel-body">
				<div class="row no-margin">
					<div class="col-lg-12">
						<form action="" id="roleForm" name="ajaxForm"
							class="form-horizontal bordered-group" role="form">
							<input type="hidden" name="role.roleId" value="$!{role.roleId}">
							<div class="form-group">
								<label class="col-sm-2 control-label">缓存:</label>
								<div class="col-sm-10">
								    <select id="typelist" data-placeholder="请选择类型" class="chosen w150">
	                                    <option value="all" selected="selected">全部</option>
	                                    <option value="article">文章</option>
	                                </select>
									<button type="button" onclick="sysCache();" class="btn btn-danger" data-theme-name="update-cache-image" >刷新缓存</button>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">索引:</label>
								<div class="col-sm-10">
                                	<button type="button"  onclick="sysSearch();" class="btn btn-danger" data-theme-name="update-index-image" >刷新索引</button>
                            	</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>


	</div>
	<!-- /main area -->

	#include( "/public-script.html") 
	#include( "/sub-script.html")
	<script>
	function sysCache() {
      swal({
            title: '确认刷新缓存?',
            text: '更新时间需几分钟 请耐心等待!',
            type: 'warning',
            showCancelButton: true,
            confirmButtonText: '确定!',
            closeOnConfirm: false,
            cancelButtonText:'取消'
        },
         function(){
        	 swal("缓存刷新中....","更新时间需几分钟 请耐心等待","success");
        	 var type = $('#typelist option:selected') .val();
        	 $.ajax({
                 url : "/admin/system/reset_cache.json",
                 type : 'get',
                 data : {'type' : type},
                 cache : false,
                 dataType : "jsonp",
                 success : function(data) {
					 console.log(data);
                	 var info='error';
                	 if(data.status ==1){
                		 info='success';
                	 } 
                	 swal(data.message, '',info);
                 }
             });
        } 
        );
    }
    function sysSearch() {
    	 swal({
             title: '确认刷新索引?',
             text: '更新时间需几分钟 请耐心等待!',
             type: 'warning',
             showCancelButton: true,
             confirmButtonText: '确定!',
             closeOnConfirm: false,
             cancelButtonText:'取消'
         },function(){
        	 swal("索引刷新中....","更新时间需几分钟 请耐心等待","success");
        	 $.ajax({
                 url : "/vrs/sys/searchIndexNotice.jsn?rand="+ new Date(),
                 type : 'POST',
                 cache : false,
                 dataType : "json",
                 success : function(data) {
                	 var info='error';
                	 if(data.success){
                		 info='success';
                	 } 
                	 swal(data.msg, '',info);
                 }
             });
         });
    	 return false;
    }
	</script>
</body>

</html>
